// ===================================
// <copyright>
// This file is part of LABSMFController.
//
//    LABSMFController is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    LABSMFController is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with LABSMFController.  If not, see <http://www.gnu.org/licenses/>.
//    Copyright 2011 David Bakker
//
//</copyright>
// <author>David Bakker</author>
// <email>mailto:DavidFBakker@gmail.com</email>
// <created>Saturday, May 07, 2011</created>
// <lastedit>Saturday, May 07, 2011</lastedit>
// ===================================

using System;
using LABSMFController.LABS.Classses;

namespace LABSMFController.LABS.Services
{
    public class BeerService
    {
        #region Delegates

        public delegate void PanicTriggerHandler(object sender, TriggerMessage message);
        public delegate void TriggerHandler(object sender, TriggerMessage message);
        #endregion

        public virtual bool EnableDebug { get; set; }
        public virtual string Description { get; set; }

        public virtual bool IsActive { get; set; }
        
        public event PanicTriggerHandler PanicTriggerEvent;
        public void InvokePanicTriggerEvent(TriggerMessage message)
        {
            PanicTriggerHandler handler = PanicTriggerEvent;
            if (handler != null) handler(this, message);
        }

        public  event TriggerHandler TriggerEvent;
        public void InvokeTriggerEvent(TriggerMessage message)
        {
            TriggerHandler handler = TriggerEvent;
            if (handler != null) handler(this, message);
        }

        public virtual void Configure()
        {
            throw new NotImplementedException();
        }

        public virtual void Start()
        {
            if (IsActive)
            {
                BeerProgram.Log(Description + " already started");
                return;
            }
            BeerProgram.Log(Description + " Starting");
            IsActive = true;
            Stop();
        }

        public virtual void StartThreads()
        {
            throw new NotImplementedException();
        }


        public virtual void Stop()
        {
            throw new NotImplementedException();
        }

        public virtual void AutoConfigure()
        {
            return;
        }

        public virtual bool IsAutoConfigureDone()
        {
            return false;
        }

        public virtual bool CanAutoConfigureDone()
        {
            return false;
        }


        public virtual string Status()
        {
            return "Is Active : " + IsActive;
        }
    }
}